const nums = [0,0,1,1,1,2,2,3,3,4]
var removeDuplicates = function(nums) {
    
     let len=nums.length
     if(len===0)return0;
     let i=0
    for(let j=1; j<len;j++)
    {
        if(nums[j]!==nums[i])
        {
            i++
            nums[i]=nums[j]
        }       
    }
    return i+1
}(nums)
console.log(removeDuplicates)
console.log(nums)